package com.hr.service;

import com.hr.dao.TalentDAO;
import com.hr.model.Talent;
import com.hr.model.User;
import com.hr.util.AuthUtil;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TalentService
{
    @Autowired
    TalentDAO talentDAO;

    public Talent getTalentByTId(int tid)
    {
        return talentDAO.getTalentByTId(tid);
    }


    public void insertTalent(Talent talent)
    {
        int aid= AuthUtil.getCurUser().getArchive().getId();
        talentDAO.insertTalentByAId(aid,talent);
    }

    public void updateTalent(Talent talent)
    {
        int aid= AuthUtil.getCurUser().getArchive().getId();
        talentDAO.updateTalent(aid,talent);
    }

    public List<Talent> getTalentByAId(int aid)
    {
        return talentDAO.getTalentsByAId(aid);
    }

    public void deleteTalent(int tid)
    {
        talentDAO.deleteTalent(tid);
    }

}
